package goleetcode

func duplicateNumbersXOR(nums []int) int {
	mp := make(map[int]bool)
	res := 0
	for _, num := range nums {
		if _, found := mp[num]; found {
			res ^= num
		} else {
			mp[num] = true
		}
	}
	return res
}